<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>do while</title>
</head>

<body>
    <script>
        //do while不管真或假都会先执行一次
        let data = 1;
        do {
            alert(1)
        } while (data === 1);
        {
            console.log("是")
        }
        console.log("---------------------------");
        //break案例
        var num = 0;
        while (num < 10) {
            console.log("i当前为:" + num);
            num++;
            //break跳出整个循环
            if (num === 5) break;
        }
        console.log("---------------------------");
        //continue案例
        var i = 0;
        while (i < 100) {
            i++;
            //continue 只跳出当前判断为true的循环
            if (i % 2 === 0) continue;
            console.log('i 当前为：' + i);
        }
    </script>
</body>

</html>